class Solution {
public:
    bool isAnagram(string s, string t) {
        if(s.length()!=t.length()){return false;}
        int cmp[26],i=0;
        fill(cmp,cmp+26,0);
        while(i<s.length()){
            cmp[s[i]-'a']++;
            cmp[t[i]-'a']--;
            i++;
        }
        for(int i=0;i<26;i++){
            if(cmp[i]!=0){return false;}
        }
        return true;
    }
};